﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DSTMEETING.BLL.Services
{
    public class CreateService
    {
        public bool CreateMeeting(string name, string creator)
        {
            using(DSTDbContext dbContext = new DSTDbContext())
            {
                Entity.Meeting meetting = new Entity.Meeting();
                meetting.Id = Guid.NewGuid();
                meetting.Name = name;
                meetting.Creator = creator;

                dbContext.Set<Entity.Meeting>().Add(meetting);

                try
                {
                    dbContext.SaveChanges();
                    return true;
                }
                catch(Exception ex)
                {
                    // log
                    return false;
                }

            }
        }
    }
}
